package com.ibeeking.found.cop.b.rest.controller.v1.feign;

import com.ibeeking.found.cop.b.rest.service.ICopDepartmentService;
import com.ibeeking.found.cop.b.rest.service.ICopEmployeeService;
import com.ibeeking.found.cop.service.common.param.CopDepartmentParam;
import com.ibeeking.found.cop.service.common.param.CopEmployeeParam;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName ContactListFeignController
 * @Description
 * @Author ibeeking
 * @Date 2020-12-01 18:15
 **/

@RestController
@RequestMapping("/b/contact/feign/v1")
public class ContactListFeignController {

    @Resource
    private ICopDepartmentService copDepartmentServiceImpl;

    @Resource
    private ICopEmployeeService copEmployeeServiceImpl;

    /**
     * 从企业微信批量导入部门列表
     * @param params
     * @return
     */
    @Log(logType = OperateLogTypeEnum.SAVE, describe = "从企业微信批量导入部门列表")
    @PostMapping(value = "/batchInsertDepartmentListFromWxCp")
    public Integer batchInsertDepartmentListFromWxCp(@RequestBody List<CopDepartmentParam> params) {
        return copDepartmentServiceImpl.batchInsertDepartmentListFromWxCp(params);
    }
    /**
     * 从企业微信导入部门信息
     * @param param
     * @return
     */
    @Log(logType = OperateLogTypeEnum.SAVE, describe = "从企业微信导入部门信息")
    @PostMapping(value = "/insertDepartmentFromWxCp")
    public Integer insertDepartmentFromWxCp(@RequestBody CopDepartmentParam param) {
        return copDepartmentServiceImpl.insertDepartmentFromWxCp(param);
    }
    /**
     * 从企业微信导入部门信息
     * @param param
     * @return
     */
    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "从企业微信导入部门信息")
    @PostMapping(value = "/updateDepartmentFromWxCp")
    public Integer updateDepartmentFromWxCp(@RequestBody CopDepartmentParam param) {
        return copDepartmentServiceImpl.updateDepartmentFromWxCp(param);
    }
    /**
     * 从企业微信删除部门信息
     * @param tenantId
     * @param id
     * @return
     */
    @Log(logType = OperateLogTypeEnum.DEL, describe = "从企业微信删除部门信息")
    @PostMapping(value = "/deleteDepartmentFromWxCp/{tenantId}/{id}")
    public Integer deleteDepartmentFromWxCp(@PathVariable("tenantId") Long tenantId, @PathVariable("id") Long id) {
        return copDepartmentServiceImpl.deleteDepartmentFromWxCp(tenantId, id);
    }

    /**
     * 从企业微信批量导入员工列表
     * @param params
     * @return
     */
    @Log(logType = OperateLogTypeEnum.SAVE, describe = "从企业微信批量导入员工列表")
    @PostMapping(value = "/batchInsertEmployeeListFromWxCp")
    public Integer batchInsertEmployeeListFromWxCp(@RequestBody List<CopEmployeeParam> params) {
        return copEmployeeServiceImpl.batchInsertEmployeeListFromWxCp(params);
    }
    /**
     * 从企业微信导入员工信息
     * @param param
     * @return
     */
    @Log(logType = OperateLogTypeEnum.SAVE, describe = "从企业微信导入员工信息")
    @PostMapping(value = "/insertEmployeeFromWxCp")
    public Integer insertEmployeeFromWxCp(@RequestBody CopEmployeeParam param) {
        return copEmployeeServiceImpl.insertEmployeeFromWxCp(param);
    }
    /**
     * 从企业微信导入员工信息
     * @param param
     * @return
     */
    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "从企业微信导入员工信息")
    @PostMapping(value = "/updateEmployeeFromWxCp")
    public Integer updateEmployeeFromWxCp(@RequestBody CopEmployeeParam param) {
        return copEmployeeServiceImpl.updateEmployeeFromWxCp(param);
    }
    /**
     * 从企业微信删除员工信息
     * @param tenantId
     * @param id
     * @return
     */
    @Log(logType = OperateLogTypeEnum.DEL, describe = "从企业微信删除员工信息")
    @PostMapping(value = "/deleteEmployeeFromWxCp/{tenantId}/{id}")
    public Integer deleteEmployeeFromWxCp(@PathVariable("tenantId") Long tenantId, @PathVariable("id") Long id) {
        return copEmployeeServiceImpl.deleteEmployeeFromWxCp(tenantId, id);
    }

}
